feat(nextjs,backend,integration): Introduce dynamic keys from clerkMiddleware - #3525
Conversation
🦋 Changeset detectedLatest commit: c458ab7 The changes in this PR will be included in the next version bump. This PR includes changesets to release 7 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
clerkMiddleware options to application serverclerkMiddleware options to application server
4dd4f25 to
31cd84c
Compare
ecf05b8 to
daf8b1c
Compare
|
I know that this is still a draft PR, so don't worry about this comment yet. Once everything's is in place, let's also add an e2e test covering this flow. Feel free to ping anyone from team-sdk about this :) |
c3f1524 to
27ba688
Compare
c782f11 to
4c4ee19
Compare
9ba87be to
99893b4
Compare
fffc077 to
220cff9
Compare
20adf12 to
a9c0509
Compare
a9c0509 to
c458ab7
Compare
|
❓ Why did we choose the approach of the cc: @LauraBeatris , @nikosdouvlis , @brkalow |
Description
Resolves SDK-1253, SDK-1811, SDK-1770
This PR introduces dynamic keys from
clerkMiddleware, solving the following problems:auth()cannot assert the session token signature due to an undefined secret key, leading to a runtime error.auth.createRedirectdoesn't redirect tosignInUrlorsignUpUrlsince those aren't propagated as well.The propagation is done by encrypting an
x-clerk-request-dataheader and sending it from the middleware runtime to the application runtime, where it's going to be decrypted using a key. The key used for encryption is resolved based on the following conditions:secretKeyare provided, thenCLERK_ENCRYPTION_KEYis requiredCLERK_SECRET_KEY, which is going to have backward compatibility.Checklist
npm testruns as expected.npm run buildruns as expected.Type of change